import { EnvironmentType, PlatformType } from "../../ADCore/Interfaces/IEnum";
import { IGameEnvironment } from "../../ADCore/Interfaces/IGameManager";
import ADQ from "../../ADCore/Core/ADQ";

/**
 * 游戏环境适配
 */
export default class GameEnvironment implements IGameEnvironment {

    urlAPI: string;
    urlResouce: string;
    environment: EnvironmentType = EnvironmentType.Development;
    platformType: PlatformType = PlatformType.PC;
    dataJson: any;
    InitEnvironment() {
        ADQ.progressManager.max+=2;
        Laya.loader.load("config/system_info.json", Laya.Handler.create(this, (data) => {
            this.environment = data.environment;
            this.platformType = data.platformType;
            this.urlAPI = data.urlAPI;
            this.urlResouce = data.urlResouce;
            this.dataJson = data;
            ADQ.progressManager.add();
        }), null, Laya.Loader.JSON);

        Laya.loader.load("config/native_files.json", Laya.Handler.create(this, (data) => {
            if (Laya.MiniAdpter)
                Laya.MiniAdpter.nativefiles = data;
                ADQ.progressManager.add();
        }), null, Laya.Loader.JSON);

    }
}